package com.bao.system.service.impl;

import com.bao.system.entity.BUser;
import com.bao.system.mapper.UserMapper;
import com.bao.system.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author bao
 * @since 2021-06-03
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, BUser> implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<BUser> allUsers() {
        return userMapper.allUsers();
    }

    @Override
    public BUser getUserById(Long id) {
        return userMapper.getUserById(id);
    }

    @Override
    public IPage<BUser> findUserPage(Page<BUser> page, QueryWrapper<BUser> wrapper) {
        return userMapper.findUserPage(page, wrapper);
    }

    @Override
    public void editUser(Long id, Integer status) {
        userMapper.editUser(id, status);
    }

    @Override
    public void editUserDep(Long id, Long departmentId) {
        userMapper.editUserDep(id, departmentId);
    }

    @Override
    public void deleUser(Long id) {
        userMapper.deleUser(id);
    }

    @Override
    public BUser login(String username, String password) {
        BUser BUser = userMapper.login(username, password);
        return BUser;
    }

}
